#include <stdio.h>

//验证输入输出的存储方式，输出转置了
void fwht_8x8_row_pass(const short* src, short* dst, int row, int dpit) {
    short* sptr = (short*)src;
    int j;

    for(j = 0; j < row; j ++ ){
        //行存入列中，输出结果转置了
        dst[0*dpit] = sptr[0];
        dst[1*dpit] = sptr[1];
        dst[2*dpit] = sptr[2];
        dst[3*dpit] = sptr[3];
        dst[4*dpit] = sptr[4];
        dst[5*dpit] = sptr[5];
        dst[6*dpit] = sptr[6];
        dst[7*dpit] = sptr[7];

        dst++;
        sptr += 8;
    };
}

int main() {
    short src[8][8] = {
        {1, 2, 3, 4, 5, 6, 7, 8},
        {9, 10, 11, 12, 13, 14, 15, 16},
        {17, 18, 19, 20, 21, 22, 23, 24},
        {25, 26, 27, 28, 29, 30, 31, 32},
        {33, 34, 35, 36, 37, 38, 39, 40},
        {41, 42, 43, 44, 45, 46, 47, 48},
        {49, 50, 51, 52, 53, 54, 55, 56},
        {57, 58, 59, 60, 61, 62, 63, 64}
    };

    short dst[8][8] = {0};
    int row = 8;
    int dpit = 8;

    fwht_8x8_row_pass((const short*)src, (short*)dst, row, dpit);

    // 打印输出矩阵
    for(int i = 0; i < 8; i++) {
        for(int j = 0; j < 8; j++) {
            printf("%d ", dst[i][j]);
        }
        printf("\n");
    }

    return 0;
}